<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 写一个把字符串大小写切换的方法
    function caseConvert(str){
    return str.replace(/([a-z]*)([A-Z]*)/g, (m, s1, s2)=>{
	    return `${s1.toUpperCase()}${s2.toLowerCase()}`
    })
  }
  caseConvert('AsA33322A2aa')
  console.log(caseConvert('AsA33322A2aa'));
  function caseConvert2(str) {
    let arr = []
    for(let x of str){
      if (x=== x.toUpperCase()) {
        x = x.toUpperCase()
      } else {
        x.toUpperCase()
      }
      arr.push(x)
    }
    return arr.join('')
  }
  console.log(caseConvert2('AsA33322A2aa'));

  </script>
</body>
</html>